package cn.gx.learn.security_boot_jwt_websocket.websocket_origin.dal.database;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.EnumTypeHandler;

import java.time.LocalDateTime;

@Data
@TableName("message_point")
@NoArgsConstructor
public class Message {
    @TableId(type = IdType.AUTO)
    private Integer id;
    @TableField(value = "type", typeHandler = EnumTypeHandler.class)
    private MessageType type;
    private String message;
    private Integer receiverId;
    private Integer senderId;
    private LocalDateTime sendTime;

    private Integer status;
    public enum MessageType {
        JOIN,
        LEAVE,
        System,
        Chat
    }
    public Message(String message,Integer receiverId,Integer senderId,LocalDateTime sendTime,Integer status){
        this.message=message;
        this.receiverId=receiverId;
        this.senderId=senderId;
        this.sendTime=sendTime;
        this.status=status;
    }

}
